<?php
include_once($URL_OBJETO.'conexion.php');
include_once($URL_OBJETO.'oSubsector.php');

class aSubsector  {
	
	// Obtiene un listado de entidades
	public function getSubsectores($codSitio , $codSector) {
		$connect = new PG();
		if(!$connect->Conectar()) {
			exit($connect->VerError());		
		}
		else {
			$sql = "SELECT * from subsector WHERE cod_sitio =".$codSitio."  AND cod_sector='".$codSector."'";

  			$lista = array();
			
			$sql = $connect->pgt_query($sql);	
			while($row = pg_fetch_array($sql)){
				$ent = new oSubsector();
				$ent->setCodSubsector($row['cod_subsector']); 
				array_push($lista, $ent);
			} 
			$connect->LimpiarConsulta();
			$connect->CerrarConexion();	
			return $lista;	
		}
	}		

}